<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>

<!DOCTYPE html>
<html>
<head>
    <title><spring:message code="message.lable.drugqualityspecSeeStd"/></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <!--[if lt IE 9]>
        <script src="${ctx}/lib/js/html5shiv.min.js"></script>
        <script src="${ctx}/lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
                            
    <section class="content-header">
        <h1>已上报短缺药品查看</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
              <li><a href="#">交易</a></li>
              <li><a href="#">药品短缺管理</a></li>
              <li><a href="#">药品短缺查看</a></li>

        </ol>
    </section>
        
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
             <form action="" id="exportExcel" method="post">
             <input id="fileName" name="fileName" type="hidden" value="<spring:message code="message.lable.drugqualityxls"/>" />
                <div class="input">
                	<div class="textalign1">通用名<spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="drugName" name="drugName" placeholder="通用名" maxlength="200"  />
                    </div>
                    <div class="textalign"><spring:message code="message.listForm.shengChanQiYe"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="compName" name="compName" placeholder="<spring:message code="message.listForm.shengChanQiYe"/>" maxlength="100" />
                    </div>
                    
                    
                    <div class="textalign" >
                         <button id="selectSpec" type="button" onclick="gridSerch();" class="btn btn-success btn-sm"><spring:message code="message.button.seachSpacing"/></button>
                   
                </div>
                </div>
              
                
            </form>
            	<form id='form1' action="${ctx}/DrugShortage/getShortageInfo.html" method="post">
            		<input type='hidden' id="drugName1" name=""  />
            	</form>
            </div>
          </div>
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
    </section>
      <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
  //绑定回车
    $('#drugName,#compName').bind('keydown', function(event) {
        if (event.keyCode == "13") {        //13 位电脑上回车键的位置代码
            $('#selectSpec').click();
        }
    }); 
  
    $("#drugName").focus();//加载页面光标在第一个查询框内
    
        function gridSerch(page) {
            var drugName = $.trim($("#drugName").val());
            var compName = $.trim($("#compName").val());
            $("#gridlist").jqGrid('setGridParam',{  
                datatype:'json',
                postData:{"drugName":drugName, "compName":compName},
                page : (page || 1)
            }).trigger("reloadGrid"); //重新载入  
        }
    
        $(function () {
            $("#gridlist").jqGrid({
                url: "${ctx}/DrugShortage/getAllShortage.html",
                mtype: "post",
                datatype: "json",
                autowidth: true,
                shrinkToFit: false,
                colNames: [
                    'shortmedicine_id',
                    '通用名', 
                    '剂型', 
                    '规格',
                    '转换系数',
                    '包装单位',
                    '生产企业',
                    '药品属性',
                    '短缺时间（月）',
                    '年需求量',
                    '国药准字号',
                    '短缺类型',
                    '缺货理由',
                    '申报日期',
                    '申报状态',
                    '申报备注',
                    '撤销备注',
                    '医疗机构编码',
                    '医疗机构名称'
                    
                ],
                colModel: [
					{ name: 'shortmedicineId', width: 120, align:"center", sortable: false,hidden:true },
                    { name: 'drugName', width: 120, align:"center", sortable: false },
                    { name: 'formName', width: 80, align:"left", sortable: false },
                    { name: 'specName', width: 100, align:"center", sortable: false},
                    { name: 'factor', width:80, align:"center", sortable: false},
                    { name: 'unitName', width: 80, align:"center", sortable: false},
                    { name: 'compName', width: 140, align:"center", sortable: false},
                    { name: 'drugAttr', width: 110, align:"center", sortable: false,
                    	formatter : function(val, opts, rowdata) {
							var str = "";
							if (val == 1) {
								str = "国家基本药物";
							} else if (val == 2) {
								str = "非基本药物";
							} else if (val == 3) {
								str = "省增补基本药物";
							} 
							return str;
						}
					},
					{ name: 'shortDate', width: 130, align:"center", sortable: false},
					{ name: 'needCount', width: 100, align:"center", sortable: false},
					{ name: 'drugMedicine', width: 150, align:"center", sortable: false},
					{ name: 'shortType', width: 80, align:"center", sortable: false,
                    	formatter : function(val, opts, rowdata) {
							var str = "";
							if (val == 1) {
								str = "价格偏低";
							} else if (val == 2) {
								str = "原材料短缺";
							} else if (val == 3) {
								str = "用量少";
							}  else if (val == 9) {
								str = "其他";
							} 
							return str;
						}},
					{ name: 'shortageReason', width: 150, align:"center", sortable: false},
                    { name: 'submitDatetime', width: 150, align:"center", sortable: false},
                    { name: 'submitStatus', width: 80, align:"center", sortable: false,
                    	formatter : function(val, opts, rowdata) {
							var str = "";
							if (val == 0) {
								str = "其他";
							} else if (val == 1) {
								str = "已申报";
							} else if (val == 2) {
								str = "已撤销";
							}
							return str;
						}},
                    { name: 'remark', width: 100, align:"center", sortable: false},
                    { name: 'cancelRemark', width: 100, align:"center", sortable: false},
                    { name: 'hospCode', width: 150, align:"center", sortable: false},
                    { name: 'hospName', width: 150, align:"center", sortable: false}
           
                    
                ],
                rowNum: 20,
                rowList: [10, 20, 50,100],
                rownumbers: true,
                pager: "#gridpage",
                multiselect: false, 
                viewrecords: true,
                caption: "已上报短缺药品列表",//品规列表
                gridComplete:function(){
                	//序号列宽度自适应（参数为jqgridID）
                    autoRNWidth("gridlist");
                	//数据只有一条时默认选中（参数为jqgridID）
                    selectByOneData("gridlist");
                },
                jsonReader: {
                	 repeatitems: false,
                    id: "" //1
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
            $("#gridlist").jqGrid("setGridHeight", create());
        });
        var scope ={
        		toDeclare:function(_drugName1,_drugQualitySpecName){
        			$('#drugName1').val(_drugName1);
        			$('#compName1').val(_compName1);
        			$('#form1').submit();
        		}
        }
      //校验
        
    </script>
</body>
</html> 
                          
                  
                  